home *** CD-ROM | disk | FTP | other *** search
- Path: news.iadfw.net!usenet
- From: Mark Nelson <markn@airmail.net>
- Newsgroups: comp.lang.c
- Subject: Re: Newbie doesn't understand compiler error
- Date: Fri, 01 Mar 1996 19:07:50 -0600
- Organization: customer of Internet America
- Message-ID: <31379F66.7BA7@airmail.net>
- References: <Pine.SUN.3.91.960301153010.11258B-100000@pioneer.uspto.gov>
- NNTP-Posting-Host: dal09-27.ppp.iadfw.net
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
-
- Max Schubert wrote:
- >
- > I have just started to work with two different learning C books. They
- > both have programs to copy and compile as I go along. Twice I have
- > received this error from cc when attempting to compile two separate
- > programs on SunOS 4.1.2:
- >
- > main( int argv, char *argc[] ) <<- Compiler states "Syntax error at or near
- > { word type char."
- >
-
- It appears that you are using the portable C compiler, which doesn't support
- this type of function definition. To get cc to work, you need to change
- the function definitions to look like this:
-
- main( argc, argv )
- int argc;
- char *argv[];
- {
-
- This should be a mechanical process that will only take you a little while
- to master. Unfortunately, it will get you accustomed to an obsolete
- idiom.
-
- A better idea is to upgrade to a C compiler that supports ANSI. If you have no
- money, gcc is a good bet.
-
- Also, it might just be a typo on your part, but the conventional argument
- names for main are argc for the integer argument, and argv for the array
- of character pointers. This doesn't have anything to do with your problem,
- however. (I think.)
-
- Mark Nelson
- http://web2.airmail.net/markn - C programming articles on line
-